import urllib2

url = 'http://www.baidu.com'

# 插件request对象
request = urllib2.Request(url)

# 添加参数
request.add_data('a=1')

# 添加header
request.add_header('User-Agent', 'Mozilla/5.0')

response = urllib2.urlopen(request)

print response.read()